package com.spring.sunflower.dialog;

import android.app.Activity;
import android.content.Intent;
import android.widget.TextView;

import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupAnimation;
import com.spring.sunflower.event.ChatSendGiftEvent;

/**
 * Created by Kevin on 2021/9/1<br/>
 * <p>
 * Describe:<br/>
 */
public class ChatSendGiftDialogUtils {
    private static ChatSendGiftDialogUtils mInstance;

    public static ChatSendGiftDialogUtils getInstance() {
        if (mInstance == null) {
            synchronized (ChatSendGiftDialogUtils.class) {
                if (mInstance == null) {
                    mInstance = new ChatSendGiftDialogUtils();
                }
            }
        }
        return mInstance;
    }

    public void show(Activity context, ChatSendGiftEvent event) {
        if (event.getGiftList() == null || event.getGiftList().size() == 0) return;
        ChatSendGiftDialog dialog = new ChatSendGiftDialog(context);
//
        dialog.setOnSendListener(new ChatSendGiftDialog.OnSendListener() {
            @Override
            public void onCrateView() {
                dialog.addData(event);
            }

        });
        new XPopup.Builder(context)
                .popupAnimation(PopupAnimation.ScaleAlphaFromCenter)
                .isRequestFocus(false)
                .dismissOnTouchOutside(false)
                .autoDismiss(false)
                .asCustom(dialog)
                .show();
    }
}